#define _CRT_SECURE_NO_WARNINGS 1
#include <iostream>
#include <string>
using namespace std;
int main()
{
    string s;
    string str;
    getline(cin, str);
    for (const auto& e : str)
    {
        if (s.empty()) s.push_back(e);
        else if (s[s.size() - 1] == e)
        {
            s.pop_back();
        }
        else
        {
            s.push_back(e);
        }
    }
    if (s.empty()) cout << 0 << endl;
    cout << s << endl;
    return 0;
}